package com.bls.productmall.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bls.productmall.entity.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    // 分页查询订单
    @Select("SELECT id,title,order_no,payment_type,user_id,total_fee,order_status,update_time FROM order_info LIMIT #{start},#{size}")
    List<Order> getOrderPage(@Param("start") int start, @Param("size")  int size);

    // 根据用户id来分页查询订单
    @Select("SELECT id,title,order_no,payment_type,user_id,total_fee,order_status,update_time FROM order_info WHERE user_id = #{userId} LIMIT #{start},#{size}")
    List<Order> getOrderByUserId(@Param("userId") int userId, @Param("start") int start, @Param("size")  int size);
}
